﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Easydp.Models.Entities;
using Easydp.Models;
using System.Data;

namespace Easydp.Controllers
{
    public class AccountInfoController
    {
        AccountInfoManager dal = new AccountInfoManager();
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// 
        public void Update(TT_AccountInfo model)
        {
            try
            {
                int i = dal.Update(model);
                if (i <= 0)
                    throw new Exception("更新失败");
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// 
        public TT_AccountInfo GetModel(int AgentID)
        {
            return dal.GetModel(AgentID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// 
        public DataSet GetDataset(string Where)
        {
            return dal.GetDataset(Where);
        }

        /// <summary>
        /// 得到列表
        /// </summary>
        /// 
        public List<TT_AccountInfo> Getlist(int AgentID)
        {
            return dal.GetList(AgentID);
        }

        /// <summary>
        /// 获取帐户信息
        /// </summary>
        /// <param name="type">帐户类型(支付宝|财付通)</param>
        /// <param name="agentID">代理商标识</param>
        /// <returns></returns>
        public TT_AccountInfo GetAccountByAccountType(string type, string agentID)
        {
            try
            {
                return dal.GetAccountByAccountType(type, agentID);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

    }
}
